package org.bigk.invoices.actions;

import java.util.Arrays;

import org.apache.struts2.convention.annotation.ParentPackage;
import org.bigk.invoices.exceptions.ServiceException;

import com.opensymphony.xwork2.ActionSupport;


@ParentPackage("invoices-default")
public class InvoicesActionSupport extends ActionSupport {

	private static final long serialVersionUID = 3109517936077758546L;
		
	public void addActionError(ServiceException ex) {
		Object[] params = ex.getErrorCodeParams();
		String msg = null;
		if (params != null) {
			msg = getText(ex.getErrorCode(), Arrays.asList(ex.getErrorCodeParams()));
		} else {
			msg = getText(ex.getErrorCode());
		}
		this.addActionError(msg);
	}
}
